package cn.gan.loveofsoul.entity;

import cn.gan.loveofsoul.config.LocalDateTimeDeserializer;
import cn.gan.loveofsoul.config.LocalDateTimeSerializer;
import cn.gan.loveofsoul.entity.vo.CommemorateDayVO;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author ganwh
 * @since 2023-10-26
 */
@Getter
@Setter
@ToString
@TableName("commemorate_day")
public class CommemorateDay implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 纪念日ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 情侣关系ID
     */
    private Integer relationshipId;

    /**
     * 纪念日类型
     */
    private String type;

    /**
     *
     */
    @TableField(value = "`order`")
    private Integer order;

    /**
     * 纪念时间
     */
    @JSONField(serializeUsing = LocalDateTimeSerializer.class, deserializeUsing = LocalDateTimeDeserializer.class)
    private LocalDateTime recordTime;

    /**
     * 备注
     */
    private String remark;

    private String background;

    Integer userId;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    private LocalDateTime updateTime;

    public static CommemorateDayVO toCommemorateDayVO(CommemorateDay commemorateDay) {
        return BeanUtil.copyProperties(commemorateDay, CommemorateDayVO.class);
    }
}
